create table "user"
(
    id            bigint generated by default as identity primary key,
    full_name     varchar(255) not null,
    birth_date    date         not null,
    login         varchar(255) not null unique,
    hash_password varchar(255) not null
);

create table phone
(
    id         bigint generated by default as identity primary key,
    user_id    bigint       not null references "user" (id) on delete cascade,
    number     varchar(255) not null unique,
    created_at timestamp    not null
);

create table email
(
    id         bigint generated by default as identity primary key,
    user_id    bigint       not null references "user" (id) on delete cascade,
    address    varchar(255) not null unique,
    created_at timestamp    not null
);

create table account
(
    id           bigint generated by default as identity primary key,
    user_id      bigint           not null references "user" (id) on delete cascade,
    init_deposit double precision not null check (init_deposit >= 0),
    amount       double precision not null check (amount >= 0),
    created_at   timestamp        not null
);